<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        <el-col :span="8">
          <el-form-item label="计划单号" prop="FBILLNO">
            <el-input v-model="dataForm.FBILLNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="计划日期" prop="FBILLCREDATE">
            <el-date-picker v-model="dataForm.FBILLCREDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="检查类型">
              <el-select v-model="dataForm.FBILLTYPE" placeholder="请选择">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="16">
          <el-form-item label="专项检查说明" prop="FNOTE">
            <el-input v-model="dataForm.FNOTE"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="计划状态">
              <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="负责人">
              <el-select v-model="dataForm.FUSER" placeholder="请选择" >
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
          <el-form-item label="检查起日" prop="FBEGDATE">
            <el-date-picker v-model="dataForm.FBEGDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
        </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="检查讫日" prop="FENDDATE">
            <el-date-picker v-model="dataForm.FENDDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
        </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="检查模板">
              <el-select v-model="dataForm.FMEMO" placeholder="请选择" >
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
          <el-form-item label="开始时间" prop="FBEGTIME">
            <el-input v-model="dataForm.FBEGTIME"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="结束时间" prop="FENDTIME">
            <el-input v-model="dataForm.FENDTIME"   />
          </el-form-item>
        </el-col>
       
        <!-- <el-col :span="5">
          <el-form-item label="">
            <el-button type="success" icon="el-icon-plus" @click="insert">添加线路</el-button>
            <el-button type="primary" :loading="loading">返回</el-button>
          </el-form-item>
        </el-col> -->

      </el-form>
    </el-row>

     <template>
     <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="检查线路" name="first">
        <el-table :data="list" border stripe>
      <el-table-column label="操作" width="80">
        <template slot-scope="scope">
          <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
            type="text">删除</el-button>
        </template>
      </el-table-column>
      <el-table-column prop="FENTRYID" label="序号" ></el-table-column>
      <el-table-column prop="FLINENAME" label="线路名称" ></el-table-column>
       <el-table-column prop="FMEMO" label="备注"></el-table-column>
      </el-table>
      </el-tab-pane>

      <el-tab-pane label="检查人员" name="second">
        <el-row class="JNPF-common-search-box" :gutter="16">
      <el-table :data="list2" border stripe>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="FENTRYID" label="序号" width="85" ></el-table-column>
          <el-table-column prop="FTYPE" label="人员分类" width="115"></el-table-column>
          <el-table-column prop="FCATNO" label="人员编号" width="135"></el-table-column>
          <el-table-column prop="FCATNAME" label="人员姓名" ></el-table-column>
          <el-table-column prop="FMEMMO" label="备注" ></el-table-column>
        </el-table>
      </el-row>
      </el-tab-pane>

    </el-tabs>
    </template>

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>
<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        activeName: 'first',
        title: "新增",
        insertorupdate: true,
        dataForm: {
            FBILLNO: "W241130001", 
            FBILLCREDATE:"2024-11-29",
            FNOTE: "2024-12每天巡查计划",
            FBEGDATE:"2024-12-01",
            FENDDATE:"2024-12-05",
            FBEGTIME:"09:00",
            FENDTIME:"11:00",
            FMEMO: "有机化学实验操作课",
            FCHECKUSE: "",
            FCHECKDATE: "",
            FBILLTYPE:"实训室自评",
            FBILLSTATE: "申请中"
        },
        rules: {
          FNOTE:[
            { required: true, message: '请输入巡检说明', trigger: 'blur' },
          ],
        },
        list: [{  "FENTRYID":1,
                  "FLINENAME": "第一教学楼每日固定巡查",
                  "FMEMO": ""
                },
                { "FENTRYID":2,
                  "FLINENAME": "第二教学楼每日固定巡查",
                  "FMEMO": "通风柜1-2"
                }],
        list2: [{   "FENTRYID":1,
                    "FTYPE": "校内专家",
                    "FCATNO":"100001",
                    "FCATNAME": "曹操",
                    "FMEMMO": ""
                  },
                  { "FENTRYID":2,
                    "FTYPE": "校外专家",
                    "FCATNO":"100002",
                    "FCATNAME": "司马懿",
                    "FMEMMO": ""
                  },
                  { "FENTRYID":3,
                    "FTYPE": "校外专家",
                    "FCATNO":"100003",
                    "FCATNAME": "朱元璋",
                    "FMEMMO": ""
                  }],
        loading: false,
        visible: false,

        options1: [{
          value: '1',
          label: '实训室自评'
        }, {
          value: '2',
          label: '实训室中心评分'
        }, {
          value: '3',
          label: '学校评分'
        }, {
          value: '4',
          label: '专家评分'
        }],

        options2: [{
          value: '1',
          label: '未确认'
        }, {
          value: '2',
          label: '已确认'
        }, {
          value: '3',
          label: '已作废'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      //
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "修改"
          this.insertorupdate = false;
        }
        else {
          this.title = "新增"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shoplist(data) {
        data.forEach(item => {
          this.list.push({
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "1"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "曹操"
          },{
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "2"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "刘备"
          })
        });
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },
    },
  };
</script>